package com.dxq.test.fragment;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.ViewSwitcher;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.blankj.utilcode.util.ObjectUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.dxq.test.App;
import com.dxq.test.R;
import com.dxq.test.activity.BreedActivity;
import com.dxq.test.activity.EventActivity;
import com.dxq.test.activity.FeedOperateActivity;
import com.dxq.test.activity.GroupActivity;
import com.dxq.test.activity.LivestockActivity;
import com.dxq.test.activity.MainActivity;
import com.dxq.test.activity.RemindActivity;
import com.dxq.test.activity.SettingActivity;
import com.dxq.test.activity.VaccineActivity;
import com.dxq.test.bean.RemindEntity;
import com.dxq.test.common.Constant;
import com.dxq.test.common.DBOperate;
import com.dxq.test.db.Label;
import com.dxq.test.db.Pasture;
import com.j256.ormlite.dao.ForeignCollection;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public class Fragment3_Main extends Fragment implements View.OnClickListener {

    private View view;// this fragment UI

    @Override
    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_main, null);
        initView();
        return view;
    }

    private void initView() {
        //tvSize1 = view.findViewById(R.id.tvSize1);

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }

    @Override
    public void onResume() {
        super.onResume();
        //getData();
        //getRemindData();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    private boolean f1hidden = false;
    private String TGA = "Fragment1";

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        f1hidden = hidden;
        if (hidden) {
            //隐藏时所作的事情
        } else {
            //显示时所作的事情
            //getData();
            //getRemindData();
        }
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()) {
            case R.id.tvXM:
                intent = new Intent(getActivity(), LivestockActivity.class);
                intent.putExtra("breedingStatus", Constant.BREEDSTATUS_CUNLAN);
                startActivity(intent);
                break;

            case R.id.tvGroup:
                startActivity(new Intent(getActivity(), GroupActivity.class));
                break;

            case R.id.tvSJ:
                startActivity(new Intent(getActivity(), EventActivity.class));
                break;

            case R.id.tvFZ:
                startActivity(new Intent(getActivity(), VaccineActivity.class));
                break;

            case R.id.tvPZ:
                startActivity(new Intent(getActivity(), BreedActivity.class));
                break;

            case R.id.tvSW:
                startActivity(new Intent(getActivity(), FeedOperateActivity.class));
                break;

            case R.id.tvTX:
                startActivity(new Intent(getActivity(), RemindActivity.class));
                break;

            case R.id.ivSetting:
                startActivity(new Intent(getActivity(), SettingActivity.class));
                break;
        }
    }

}
